<template>
  <div class="news-box" :class="{'right-box': zone.type == 'zixun'}">
    <div class="sub-title">
      <span class="zh-t"><i class="iconfont"></i>{{ zone.zoneName }}</span>
      <nuxt-link :to="{ name: 'post-list', query: { leixing: zone.type } }" class="more-link">更多 ></nuxt-link>
    </div>
    <ul id="newList1" class="news-list">
      <li v-for="(that, int) in zone.postList" :key="int" :class="{'last-child': int == zone.postList.length - 1}">
        <nuxt-link target="_blank" :to="{ name: 'post-id', params: { id: that.id } }" :title="that.mingcheng">
          {{ sub(that.mingcheng) }}<span class="news-date">{{ formatDat(that.gmtCreate) }}</span>
        </nuxt-link>
      </li>
    </ul>
  </div>
</template>
<script>
import { substr } from '@/utils/utils.js'

export default {
  components: {
  },
  props: {
    zone: {
      type: Object,
      default: null
    }
  },
  methods: {
    sub(str) {
      return substr(str, 26)
    },
    formatDat(d) {
      if (d && d.length >= 10) {
        return d.substring(0, 10)
      }
      return d
    }
  }
}
</script>
